/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package seso;

import java.awt.Graphics;
import java.awt.Image;

/**
 *
 * @author Administrator
 */
public class RTableHeaderBackground extends javax.swing.JLabel {
    
    private Image leftImage = Util.getUserImage("resources/TableHeaderLeftBackground.png");
    private Image middleImage = Util.getUserImage("resources/TableHeaderMiddleBackground.png");
    private Image rightImage = Util.getUserImage("resources/TableHeaderRightBackground.png");
    
    private int imageHeight = leftImage.getHeight(null);
    private int leftImageWidth  = leftImage.getWidth(null);
    private int rightImageWidth = rightImage.getWidth(null);
    
    
    public RTableHeaderBackground() {
        super();
        setOpaque(false);  // Must be false
        
        setSize(600, imageHeight);
        setPreferredSize(new java.awt.Dimension(600, imageHeight));
    }
    
    
    @Override
    protected void paintComponent(Graphics g) {

        int width = getWidth();
        int height = getHeight();
        
        g.drawImage(leftImage, 0, 0, leftImageWidth, height, null);
        g.drawImage(rightImage, width - rightImageWidth, 0, rightImageWidth, height, null);
        g.drawImage(middleImage, leftImageWidth , 0, width - leftImageWidth - rightImageWidth , height, null);

        super.paintComponent(g);
    }
    
    
}
